package pl.kkalisz.android.ui.splash;

import pl.kkalisz.android.uApplication;
import pl.kkalisz.android.R;
import pl.kkalisz.android.R.layout;
import pl.kkalisz.android.R.menu;
import pl.kkalisz.android.model.error.uException;
import pl.kkalisz.android.model.error.uWindowNotFoundException;
import pl.kkalisz.android.model.window.uWindowBuilder;
import pl.kkalisz.android.model.window.uWindows;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;

public class uSplashActivity extends Activity {


    SplashHandler mHandler = new SplashHandler();
    Message msg = new Message();
    Context mContext;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        mContext = this;
        msg.what = 1;
        mHandler.sendMessageDelayed(msg, 3000);
       ((uApplication)getApplication()).onStart();

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_splash, menu);
        return true;
    }



    private class SplashHandler extends Handler {

        public void handleMessage(Message msg)    
        { 
            try 
            {
                uWindowBuilder abuilder = new uWindowBuilder((Activity) mContext, uWindows.MAIN_MENU_ACTIVITY, true);
                abuilder.show();
            } 
            catch (uWindowNotFoundException e) 
            {
                e.printStackTrace(mContext);
            }
        }
    }

}
